import { Button, Form, Input, DatePicker, Radio } from "antd";
import "./userAdd.css";
import services from "../services";
function UserAdd() {
  const form = Form.useFormInstance();
  const layout = {
    labelCol: { span: 16 },
    wrapperCol: { span: 16 },
  };
  const submit = async (value) => {
    console.log(value);
    let res = await services.addList({
      user: value.user,
      height: value.height,
      weight: value.weight,
      age: value.age,
      sex: value.sex,
      birthday: value.birthday,
    });
    console.log(res);
  };

  return (
    <Form form={form} {...layout} style={{ maxWidth: 600 }} onFinish={submit}>
      <Form.Item label="Name" name="user">
        <Input placeholder="请输入昵称" />
      </Form.Item>
      <Form.Item label="Sex" name="sex">
        <Radio.Group>
          <Radio value="man" name="男">
            {" "}
            男{" "}
          </Radio>
          <Radio value="woman" name="女">
            {" "}
            女{" "}
          </Radio>
        </Radio.Group>
      </Form.Item>
      <Form.Item label="Age" name="age">
        <Input placeholder="请输入年龄" />
      </Form.Item>
      <Form.Item label="Height" name="height">
        <Input placeholder="请输入身高" />
      </Form.Item>
      <Form.Item label="Weight" name="weight">
        <Input placeholder="请输入体重" />
      </Form.Item>
      <Form.Item label="Birthday" name="birthday">
        <DatePicker />
      </Form.Item>
      <Form.Item>
        <Button type="primary" className="btn" htmlType="submit">
          提交
        </Button>
      </Form.Item>
    </Form>
  );
}
export default UserAdd;
